<div class="lblock sidebar">
	<div class="category_display">
		<div class="inner">
			<h3><a href="#">Show all products</a></h3>
			<ul class="maincats">
				<?php
					foreach ($cat_menu_arr as $cat_menu_entry) :

                                            if($cat_menu_entry['cat_id']==50){
                                                $catlink=SITEURL."index.php/?printsearch";

                                            }
                                            else{
                                                 $catlink=SITEURL."index.php/?viewproducts/cat/".$cat_menu_entry['cat_id']; 
                                            }
				?>
					<li><a href="<?php echo $catlink;?>"><?php echo $cat_menu_entry['cat_desc']; ?></a>
						<div class="subcats">
                                       
						<ul>
					<?php
						foreach ($subcat_menu_arr as $subcat_menu_entry) :
							if($subcat_menu_entry['SUBCATID'] == $cat_menu_entry['cat_id']) {
					?>
						
					    	<li><a href="<?php echo SITEURL; ?>index.php/?viewproducts/subcat/<?php echo $subcat_menu_entry['CATID']; ?>"><?php echo $subcat_menu_entry['PARENTCAT']; ?></a></li>
					    
					<?php
							}
						endforeach;
					?>
						</ul>
                                       <?php //endif;?>
					</div>
					</li>
				<?php
					
					endforeach;
				?>				
			</ul>
		</div>
	</div>
    <?php if($prombanner_arr):?>
	<div class="category_display" >
		<div class="inner">
			<h3><a href="#">Promotions</a></h3>			
			<div class="promos">
                            <?php foreach($prombanner_arr as $arr):?>
				<a target="<?php echo ($arr["newwindow"]=="checked")?"_blank":"_self";?>" href="<?php echo $arr["url"];?>"><img src="<?php echo SITEURL?>/images/promobanner/thumbs/<?php echo $arr["filename"] ; ?>" alt="" width="236" /></a>
			<?php endforeach;?>
			</div>			
		</div>
	</div>
    <?php endif;?>
	<div class="search_filters" style="">
            <form name="powersearchform" id="powersearchform" method="post" action="<?php echo SITEURL; ?>index.php?viewproducts/<?php echo $param1 ?>/<?php echo $param2 ?>">
           <input type="hidden" name="param1" id="param1" value="<?php echo $param1;?>">
            <input type="hidden" name="param2" id="param2" value="<?php echo $param2;?>">
          <?php  foreach($features_arr as $arr):

                $structval_arr=DB::fetchAll("select distinct structvalue from tbl_productfeatures f inner join tbl_products p on f.productid=p.productid where f.structkey='".$arr["structkey"]."' and p.product_cat_id=".$arr["catid"]."");
                ?>
            <?php if($structval_arr):?>
		<div class="filter_panel">
                    <h3><?php echo $arr["structkey"];?> <span class="toggle"><span class="plus">+</span><span class="minus">-</span></span></h3>
                    <?php foreach($structval_arr as $strvalarr):
                              if($strvalarr):
                        ?>
			
			<ul>
                            
				<li class="mblock clearfix">
					<div class="lblock"><input <?php echo in_array($arr["structkey"]."|". $strvalarr["structvalue"],$_POST["structval"])?"checked":""; ?> onclick="submitform()"value="<?php echo $arr["structkey"];?>|<?php echo $strvalarr["structvalue"] ?>" type="checkbox" name="structval[]" id="<?php echo $arr["structkey"];?>|<?php echo $strvalarr["structvalue"] ?>" /></div>
					<div class="cblock"><label for="<?php echo $arr["structkey"];?>|<?php echo $strvalarr["structvalue"] ?>"><?php echo $strvalarr["structvalue"] ?></label></div>
				</li>
                            
				 
			</ul>
                         <?php 
                          endif;
                         endforeach;?>
		</div>
		<?php endif;?>

		<?php endforeach;?>
            </form>
	</div>
</div>

<script type="text/javascript" charset="utf-8">
	$(function(){
		$(".filter_panel h3 .toggle").click(function(){
			$(this).parent().parent().toggleClass("open");
		});
	})

        function submitform()
        {
            document.powersearchform.submit();
        }
</script>